
package lxycx.clazz;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

public class ClassUtil {

	//DE100加密class
	public static void encode() throws IOException{
		char[] ss = new char[] {'敢','觉','人','生','到','达','了','巅','峰'};
		InputStream in = new FileInputStream(new File("C:\\Users\\Administrator.HLKJ-20160414ZA\\Desktop\\TestImpl.class"));
		OutputStream out = new FileOutputStream(new File("C:\\\\Users\\\\Administrator.HLKJ-20160414ZA\\\\Desktop\\\\TestImpl2.class"));
		byte[] bb = new byte[100];
		int len = 0;
		while((len = in.read(bb, 0, 99))!=-1) {
			bb[len] = (byte) ss[(int) (Math.random()*9)];
			out.write(bb, 0, len+1);
		}
		in.close();
		out.close();
	}
	
	//DE100解密class
	public static void decode() throws IOException{
		InputStream in = new FileInputStream(new File("C:\\Users\\Administrator.HLKJ-20160414ZA\\Desktop\\TestImpl2.class"));
		OutputStream out = new FileOutputStream(new File("C:\\\\Users\\\\Administrator.HLKJ-20160414ZA\\\\Desktop\\\\TestImpl3.class"));
		byte[] bb = new byte[100];
		int len = 0;
		while((len = in.read(bb, 0, 100))!=-1) {
			out.write(bb, 0, len-1);
		}
		in.close();
		out.close();
	}
		
}

